package com.edu.web.servlet;

import com.edu.bean.Book;
import com.edu.service.BookService;
import com.edu.service.impl.BookServiceImpl;
import com.edu.service.impl.BookServiceImpl;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.List;

/**
 * @Author:max
 * @Date: 2024/9/14 16:58
 * @Description:
 */

@WebServlet("/LoadServlet")
public class LoadServlet extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        BookService bs=new BookServiceImpl();
        List<Book> books=bs.SelectBooksService();
        System.out.println(books);
        req.setAttribute("books",books);
       req.getRequestDispatcher("index.jsp").forward(req, resp);
    }
}
